package com.mobis.article.controller;

import com.mobis.article.pojo.Article;
import com.mobis.article.service.ArticleService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping(value = "/article")
public class ArticleController
{
    @Autowired
    private ArticleService articleService;



    @RequestMapping(value = "/examine/{articleId}",method = RequestMethod.PUT)
    public Result examine(@PathVariable String articleId){
        System.out.println("123");
        articleService.examine(articleId);
        return  new Result(true, StatusCode.OK,"操作成功");
    }
    @RequestMapping(value = "/addThumbup/{articleId}",method = RequestMethod.PUT)
    public Result addThumbup(){

        return new Result(true,StatusCode.OK,"点赞成功");
    }

    @RequestMapping(value = "/{articleId}",method = RequestMethod.GET)
    public Result findArticleById(@PathVariable String articleId){
        Article article=articleService.findArticleById(articleId);
        return  new Result(true,StatusCode.OK,"查找成功",article);
    }
}
